package com.appkubes.mall.admin.application.customer.taobao.controller;

import com.appkubes.cloud.config.params.paramValid.ParamValid;
import com.appkubes.common.Response;
import com.appkubes.mall.admin.application.customer.customer.service.CustomerService;
import com.appkubes.mall.admin.application.customer.taobao.entity.vo.BindPidParamVO;
import com.appkubes.mall.admin.application.customer.taobao.entity.vo.ModifyAlipayInfoVO;
import com.appkubes.mall.admin.application.customer.taobao.service.CustomerToabaoService;
import com.appkubes.mall.core.controller.BaseMallCustomerController;
import com.appkubes.mall.core.controller.BaseMallCustomerTaobaoController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Rongjie
 * @Date: 2020/3/4
 * @Description:
 */
@Api(tags = "淘宝渠道用户")
@RestController
@RequestMapping("/customer/taobao")
public class CustomerTaobaoController extends BaseMallCustomerTaobaoController {

    @Autowired
    CustomerToabaoService customerToabaoService;

    @PostMapping("/modifyAlipayInfo")
    @ApiOperation("修改支付宝信息")
    public Response modifyAlipayInfo(@ParamValid ModifyAlipayInfoVO modifyAlipayInfoVO) {
        Boolean res = customerToabaoService.modifyAlipayInfo(modifyAlipayInfoVO.getCustomerKey(),
                modifyAlipayInfoVO.getAlipayAccount(),
                modifyAlipayInfoVO.getAlipayName());
        return Response.success(res);
    }

    @PostMapping("/bindPid")
    @ApiOperation("绑定pid")
    public Response bindPid(@ParamValid BindPidParamVO bindPidParamVO) {
        Boolean res = customerToabaoService.bindPid(bindPidParamVO.getCustomerKey(), bindPidParamVO.getPid());
        return Response.success(res);
    }
}
